package com.trace.meat;


import com.trace.meat.controller.*;
import com.trace.meat.entity.*;
import com.trace.meat.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.servlet.http.HttpServletRequest;
import java.lang.Process;
import java.util.*;

@SpringBootTest
public class OTCtest {
    @Autowired
    private OrderTblService orderTblService;
    @Autowired
    private AnimalController AC;
    @Autowired
    private BreederController BC;
    @Autowired
    private AdminAcctController adminAcctController;
    @Autowired
    private EntController entController;
    @Autowired
    private ProductController PC;
    @Autowired
    private LicService LS;
    @Autowired
    private EntService ES;
    @Autowired
    private AnimalService AS;
    @Autowired
    private BreederService BS;
    @Autowired
    private ButcherService BCS;
    @Autowired
    private ProductService PS;
    @Autowired
    private OrderTblController OTC;
    @Autowired
    private  HandleController handleController;
    @Autowired
    private TypeTblService TTC;
    @Autowired
    private ProcessService processService;
    @Test
    void fn()
    {
        /**
         * HandleController测试

        System.out.println(handleController.SelectG(1,0));//msg='查询牲畜信息成功'
        System.out.println(handleController.SelectG(11,3));//msg='产品id或产品类型错误'
        System.out.println(handleController.Chain_Form(1,0));//msg='链条合成成功'
        System.out.println(handleController.Chain_Form(11,0));//msg='牲畜信息记录有误'
        System.out.println(handleController.Chain_Form(1,2));//msg='输入类型错误'

         */

        /**  //注册测试用例
        System.out.println(entController.register("clearloveA","cleralove4396",
                101,"1545648","厂长养猪厂",null));
        System.out.println(entController.register("7","cleralove4396",
                101,"1545648","厂长养猪厂2",null));
        System.out.println(entController.register("clearloveA2","4396",
                101,"1545648","厂长养猪厂3",null));
        System.out.println(entController.register("","cleralove4396",
                101,"1545648","厂长养猪厂4",null));
        System.out.println(entController.register("clearloveA4","cleralove4396",
                101,"1545648","厂长养猪厂6","clearlove@edg.com"));
        */
        /**
         *AdminAcctController测试用例

        System.out.println(adminAcctController.login("l6kj","123"));//msg='登录成功'
        System.out.println(adminAcctController.login("","123"));//msg='用户名不可为空'
       System.out.println(adminAcctController.login("l6kj",""));//msg='密码不可为空'
        System.out.println(adminAcctController.login("wwww","213"));//msg='用户名不存在'
        System.out.println(adminAcctController.login("l6kj","222"));//msg='密码错误'
       System.out.println(adminAcctController.Lic_Screen("a养殖场",1,"12",1));//msg='筛选成功'
        System.out.println(adminAcctController.Account_Screen("tazibreed","獭子养殖场",101,"114514",null));//msg='筛选成功'
         **/

      //System.out.println(entController.login("clearloveA","cleralove4396"));
        //System.out.println(entController.login("clearloveA","cleralove"));
        //System.out.println(entController.login("clearlove4546","cleralove4396"));
         //System.out.println(processService.queryByPId(9));
        //System.out.println(HC.Chain_Form(9,1));
        //System.out.println(AAC.Lic_Screen(null,null,null,null));
        //System.out.println(AAC.Account_Screen(null,"獭子",null,null,null));
        //System.out.println(LS.getModelByEId(1));
        //System.out.println(AAC.Account_Screen(null,"李田所养猪厂",null,null,null));
        //System.out.println(AAC.Account_Screen(null,null,null,null,null));
        //System.out.println(EC.AddStock(1,1,2,1));
        //System.out.println(EC.SelectALlProcess(2));
        //System.out.println(EC.lastPosition(9,0));
        //System.out.println(AAC.Account_Screen(null,null,null,null,null));
        //System.out.println(AAC.register("clearloveadmin","4396777"));
        /**Lic lic=new Lic();
        lic.setLicType(null);
        lic.setEid(null);
        lic.setSerNum(null);
        System.out.println(LS.queryAll(lic));
         */
        //System.out.println(EC.confirm(1,1,1,"4545",""));
        //System.out.println(EC.SelectAllStock(1));
        //System.out.println(EC.AddAnimal(5001,50010001,7));
        //System.out.println(EC.SelectAllButcher(1));
//        System.out.println(EC.SelectAllProductType(5001));
//        System.out.println(EC.SelectAllBreedType(5001));
//        System.out.println(EC.SelectAllAnimalType());
        //System.out.println(TTC.queryAllById(101,104));
        //System.out.println(EC.SelectAllEntType());
        //System.out.println(EC.SelectAllLicType());
        //System.out.println(TTC.queryAllType());
        //System.out.println(new Date().getTime());
        //System.out.println(LS.getModelByEId(1));
        //System.out.println(EC.UpdateAnimal(1,"2021-6-26",5001,50010001,1,3,(short) 1));
        //System.out.println(OTC.Chain_Form(1,0));
        //System.out.println(EC.SelectAllAnimal(1));
        //System.out.println(EC.SelectAllBreeder(1));
        //System.out.println(BS.queryModelByEId(1));
        //System.out.println(AS.queryModelByBId(1));
        /**
        Hashtable hashtable=new Hashtable();
        List<Integer> list1=new ArrayList<Integer>();
        list1.add(1);
        list1.add(2);
        hashtable.put("list1",list1);
        List<Integer> list2=new ArrayList<Integer>();
        list2.add(7);
        list2.add(7);
        hashtable.put("list2",list2);
        System.out.println(hashtable.get("list1"));
        System.out.println(hashtable.get("list2"));
     */
     /**
        Result result=HC.Chain_From(3);
        System.out.println(result);
         */
        /**List<OrderTbl> orderTbl=OTC.Chain_Form(4);
        Iterator it=orderTbl.listIterator();
        OrderTbl o=(OrderTbl) it.next();
        System.out.println(o);*/
        //System.out.println(PS.queryModelById(1));
        //System.out.println(orderTblService.queryModelById(1));
        //System.out.println(BCS.queryModelById(1));
        //System.out.println(BS.queryModelById(1));
        //System.out.println(AS.queryModelById(1));
        //System.out.println(ES.queryModelById(1));
        //System.out.println(LS.getModelById(1));
        //System.out.println(this.EC.queryByToken("209d4e0c214145b8a0aa1571e1c62ec5"));
        //this.PC.insert(5001001,Double.valueOf(1),"2021-6-24",1,(short)1,1,1);
        //AAC.register("uziadmin","2200");
        //String uuid = UUID.randomUUID().toString().replaceAll("-","");
        //System.out.println(uuid);
        //Result result=AAC.login("clearloveadmin","4396");
        //Result result=AAC.register("clearloveadmin","4396777");
        /**管理员账号登录注册
         *
        Result result=AAC.register("clearloveadmin","4396777");
        System.out.println(result);
        result=AAC.login("clearloveadmin","4396777");
        System.out.println(result);
         */

        //Result result=EC.login("dasda","1545");

        //EC.register("clearlovetu","1145141",102,"1919810","屠宰厂");
        /**企业账号注册登陆
         *
         System.out.println(EC.register("clearloveyangzhi","1145141",1,"1919810","养猪厂"));
        Result result= EC.login("clearloveyangzhi","1145141");
        result.getDetail();
        System.out.println(result);
         */
         /**状态码
        System.out.println(StateCode.Login_Fail.getState());
        System.out.println(StateCode.Login_Fail.getCodenum());
        System.out.println(StateCode.Login_Fail.toString());
        */
         /**加密
        String temp=bCryptPasswordEncoder.encode("114514");
        System.out.println(temp);
        System.out.println(bCryptPasswordEncoder.matches("114514",temp));
         */
        /**按企业编号生成列表
        Iterator<Breeder> it=BC.selectAllByEid(1).listIterator();
        while (it.hasNext())
        {
            System.out.println(it.next());
        }*/
    }

}
